<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

    <h1>获得服务器更新</h1>
    <div id="result"></div>

    <script>
        //监听postmessage的推送
        window.addEventListener('message',function(e){
            console.log('已监听到message事件: ',e);
            if(e.origin == 'http://127.0.0.1'){
                console.log('进入窗口：127.0.0.1');
                //to do something
                e.source.postMessage(e.data,e.origin)
            }
        },false);
        /*setTimeout(function(){
            //父窗口引用
            window.opener.location.reload()
        },3000)*/

    </script>

</body>
</html>